<?php

namespace App\depository;

use App\Models\SystemModel;

class SystemDep
{
    public $model;

    public function __construct()
    {
        $this->model = new SystemModel();
    }

    public function firstByName($name){

        $res = $this->model->where('name',$name)->first();
        return $res;

    }

    public function first(){
        return $this->model->first();
    }



    public function list($param)
    {
        $res = $this->model->orderBy('id','desc')->get();
        return $res;
    }


    public function add($data)
    {
        $res = $this->model->insertGetId($data);
        return $res;
    }

    public function upd($id, $data)
    {
        $res = $this->model->where('id', $id)->update($data);
        return $res;
    }

    public function del($id)
    {
        $res = $this->model->where('id', $id)->delete();
        return $res;
    }

}
